#pragma once

#include <iostream>
#include <functional>

namespace tcp
{
class tcp_server;

class task
{
public:
    using Callback = std::function<void(tcp_server*, int, const std::string&)>;

public:
    task()
    {}

    task(Callback cb, tcp_server* ts, int fd, const std::string& name)
        : _cb(cb), _ts(ts), _sock(fd), _name(name)
    {}

    void operator()()
    {
        _cb(_ts, _sock, _name);
    }

private:
    Callback _cb;
    tcp_server* _ts;
    int _sock;
    std::string _name;
};

}
